
from app.common.model import BaseModel, RecodeMixinModel
from sqlalchemy import Column, DateTime, Float, String, INT


class CouponModel(BaseModel):
    __tablename__ = 'coupon'
    id = Column(INT, autoincrement=True, primary_key=True, comment='自增ID')
    name = Column(String(32), nullable=False, comment='优惠券名称')
    discount_amount = Column(INT, nullable=False, comment='优惠券金额')
    cate_id = Column(INT, nullable=False, comment='优惠券分类ID')
    min_amount = Column(Float, nullable=False, comment='满减金额')
    total_num = Column(INT, nullable=False, comment='优惠券数量')
    get_num = Column(INT, nullable=False, comment='优惠券领取数量')
    use_num = Column(INT, nullable=False, comment='优惠券使用数量')
    status = Column(INT, nullable=False, comment='优惠券状态')
    limit_get_num = Column(INT, nullable=False, comment='领取数量')
    bind_client_phone = Column(INT, nullable=False, comment='是否绑定领取手机号')
    use_rule_id = Column(INT, nullable=False, comment='使用条件ID')
    valid_days = Column(INT, nullable=False, comment='有效期天数')
    start_time = Column(DateTime, nullable=False, comment='创建时间')
    end_time = Column(DateTime, nullable=False, comment='过期时间')
    goods_ids = Column(String(255), nullable=False, comment='优惠券商品ID')
    goods_cate_ids = Column(String(255), nullable=False, comment='优惠券商品分类ID')
    sort = Column(INT, nullable=False, comment='优惠券排序')
    description = Column(String(255), nullable=False, comment='优惠券描述')


# class CouponRuleModel(BaseModel):
#     __tablename__ = 'coupon_rule'
#     id = Column(INT, autoincrement=True, primary_key=True, comment='自增ID')
#     name = Column(String(32), nullable=False, comment='优惠券规则名称')
#     sort = Column(INT, nullable=False, comment='优惠券规则排序')
#     status = Column(INT, nullable=False, comment='优惠券规则状态')
#     remark = Column(String(255), nullable=False, comment='优惠券规则描述')


class CouponCateModel(BaseModel):
    __tablename__ = 'coupon_cate'
    id = Column(INT, autoincrement=True, primary_key=True, comment='自增ID')
    key = Column(INT, nullable=False, comment='优惠券值')
    name = Column(String(32), nullable=False, comment='优惠券分类名称')
    status = Column(INT, nullable=False, comment='优惠券分类状态')
    remark = Column(String(255), nullable=False, comment='优惠券分类描述')
